#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <deque>
#include <stack>
using namespace std;
typedef long long ll;
#define pii pair<int, int>
const ll maxn = 2e5 + 10;
const ll inf = 1e17 + 10;
pii num[maxn];

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    long long ans = 0;
    for(int i=0; i<n; i++)
    {
        scanf("%d", &num[i].first);
        num[i].second = 0;
        ans += num[i].first;
    }
    ll pre = 0, val = 0;
    for(int i=1; i<=m; i++)
    {
        int t;
        scanf("%d", &t);
        if(t == 1)
        {
            int a, b;
            scanf("%d%d", &a, &b);
            a--;
            if(num[a].second < pre)
            {
                num[a].first = val;
                num[a].second = pre;
            }
            ans -= num[a].first;
            ans += b;
            num[a].first = b;
            num[a].second = i;
        }
        else
        {
            ll a;
            scanf("%lld", &a);
            ans = n * a;
            pre = i;
            val = a;
        }
        printf("%lld\n", ans);
    }

    return 0;
}